package main
import(
	"fmt"
)
//for 循环
func main(){
	//step 循环
	var i int = 0;
	for ;i<=10;i++{
		fmt.Println(i)
	}
	fmt.Println(i)
	fmt.Println("for循环1完毕")

	// 条件循环
	for i > 0 {
		i--
		fmt.Println(i)
	}

	fmt.Println("for循环2完毕")
	//无限循环

	for {
		fmt.Println(i)
		i++
		if(i>=10){
			break;
		}
	}
	fmt.Println("for循环3完毕")

	var str string = "nihaoworld!"
	for k:=0;k<len(str);k++{
		fmt.Printf("%c ",str[k])
	}
	fmt.Println("for循环4完毕")

	for index,val := range str{
		fmt.Printf("index=%d,val=%c ",index,val)
	}
}